taking :skip in nested collection into account#54
Open
thedarkside wants to merge 1 commit into
Open
Conversation
Contributor
|
looks good for me |
pablobm
reviewed
Sep 29, 2022
| module Page | ||
| class NestedCollection < Page::Collection | ||
| def attribute_names | ||
| options.fetch(:collection_attributes, dashboard.collection_attributes) |
Collaborator
There was a problem hiding this comment.
How about the following? That way you only call dashboard.collection_attributes lazily, when there is no :collection_attributes available:
Suggested change
| options.fetch(:collection_attributes, dashboard.collection_attributes) | |
| options.fetch(:collection_attributes) { dashboard.collection_attributes } |
Owner
|
Is there anything we could do for testing here? |
Contributor
|
@thedarkside do you want put this in field of hasMany module on main administrate project? def associated_collection(order = self.order)
Administrate::Page::NestedCollection.new(associated_dashboard, order: order, collection_attributes: options.fetch(:collection_attributes))
endand in Page::Collection def attribute_names
options.fetch(:collection_attributes) || dashboard.collection_attributes
end |
|
Looks good for me. |
1 task
Owner
|
We need to add some test coverage around the change, that's the main thing, if you'd like to take a look, @goosys? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This solves #12 by taking the
:skipoption into account while rendering nested collections.Currently i don't have time to implement tests. Maybe someone wants to volunteer? :)
Works as expected in our current implementation using v1.3.0